<?php
class articleCategoryList extends CWidget
{
	public $htmlOptions = array(
		'id'=>'category',
		'class'=>'category'
	);
	
	public $view = 'category';
	
	
	public $data= array();
	
	public $model;
	
	public function getCategoriesByType($type)
	{
		$result = array();
		
		$models = Category::model()->getCategoryModelByType($type);
		
		foreach ($models as $model)
		{
			$result[] = $model->attributes;
		}
		
		return $result;
		
//		return  Category::model()->getChildrenObject($models);	
	
		
	}
	
	public function getData()
	{

		
		foreach (Category::model()->ArticleCategoryId() as $item)
		{
			$this->data = array_merge($this->data,$this->getCategoriesByType($item));
			
			
		}
		
		$this->data = UArray::ArraytoObject(Category::model()->getChildrenArray($this->data));
		
	}
	
	public function run()
	{
		$this->getData();
		
		$this->render($this->view,array(
//			'model'=>$this->data
		));
	}
}
?>